﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.IO;
using COFE.Core.Utils;

namespace COFE.Core.Filter
{
    /// <summary>
    /// IEntryFilter that match everything.
    /// </summary>
    public class AllEntryFilter : IEntryFilter
    {
        string _pattern;

        public AllEntryFilter(string pattern = "*")
        {
            _pattern = pattern;
        }

        public bool Matches(IInternalFileSystemInfoExA entry)
        {
            if (_pattern == "*")
                return true;
            else return StringUtils.MatchFileMask(entry.Name, _pattern);
        }

        public override string ToString()
        {
            return "all=" + _pattern;
        }
    }
}
